package chess;

import java.awt.*;
import javax.swing.*;

public class PromotionPopup extends PopupWindow //khi quan tot di den cuoi ban co se dc phong....
{
	private static final long serialVersionUID = 5337411370661157823L;

	public PromotionPopup(GUI listener)
	{
		super(listener, "Promote Pawn To:");
		
		setLayout(new GridLayout(2,2));
		
		JButton[] pieces = new JButton[4];
		pieces[0] = new JButton("Queen");
		pieces[1] = new JButton("Rook");
		pieces[2] = new JButton("Bishop");
		pieces[3] = new JButton("Knight");
		
		for(int x=0; x<pieces.length; x++)
		{
			pieces[x].addActionListener(listener);
			pieces[x].setActionCommand("-"+(x+1)); //lam sao xac dinh button nao da duoc nhan khi nhung button tren deu co chung ham xu ly su kien click de thay doi quan co, them action command cho cac button
			add(pieces[x]);
		}
		
		//pack();
		resetLocation();
	}
}

